package com.bawei.hgshop.entity;

import java.beans.Transient;
import java.io.Serializable;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 *  spu  商品 
 *  
 * @时间  2021-1-12  9:08:26
 *
 */

@Document(indexName = "hgshop_index" ,type = "spu") 
public class Spu implements Serializable {
	                                        
	/**
	 * 
	 */
	private static final long serialVersionUID = 2748070909443630232L;
	
	@Id 
	private int id                       ;
	@Field(fielddata = true,type = FieldType.Text)
	private String goodsName               ;
	private int isMarketable            ;
	@Field(fielddata = true,type = FieldType.Text)
	private String caption                  ;
	private String smallPic                ;
	
	private Category category;  //分类
	private Brand brand;   //品牌
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getGoodsName() {
		return goodsName;
	}
	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	
	public int getIsMarketable() {
		return isMarketable;
	}
	@Transient
	public void setIsMarketable(int isMarketable) {
		this.isMarketable = isMarketable;
	}
	public String getCaption() {
		return caption;
	}
	public void setCaption(String caption) {
		this.caption = caption;
	}
	public String getSmallPic() {
		return smallPic;
	}
	public void setSmallPic(String smallPic) {
		this.smallPic = smallPic;
	}
	@Transient
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	@Transient
	public Brand getBrand() {
		return brand;
	}
	public void setBrand(Brand brand) {
		this.brand = brand;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
		result = prime * result + ((caption == null) ? 0 : caption.hashCode());
		result = prime * result + ((category == null) ? 0 : category.hashCode());
		result = prime * result + ((goodsName == null) ? 0 : goodsName.hashCode());
		result = prime * result + id;
		result = prime * result + isMarketable;
		result = prime * result + ((smallPic == null) ? 0 : smallPic.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Spu other = (Spu) obj;
		if (brand == null) {
			if (other.brand != null)
				return false;
		} else if (!brand.equals(other.brand))
			return false;
		if (caption == null) {
			if (other.caption != null)
				return false;
		} else if (!caption.equals(other.caption))
			return false;
		if (category == null) {
			if (other.category != null)
				return false;
		} else if (!category.equals(other.category))
			return false;
		if (goodsName == null) {
			if (other.goodsName != null)
				return false;
		} else if (!goodsName.equals(other.goodsName))
			return false;
		if (id != other.id)
			return false;
		if (isMarketable != other.isMarketable)
			return false;
		if (smallPic == null) {
			if (other.smallPic != null)
				return false;
		} else if (!smallPic.equals(other.smallPic))
			return false;
		return true;
	}
	
	
	


}
